/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
 * Description: 上机编程认证
 * Note: 缺省代码仅供参考，可自行决定使用、修改或删除
 */
#include <iostream>
#include <string>
#include <stack>
using namespace std;

class Solution {
private:
    int getNumber(int &index, const string &expression) {
        int result = 0;
        while (index < expression.size() and isdigit(expression[index])) {
            result = result * 10 + expression[index] - '0';
            index++;
        }
        return result;
    }

public:
    // 待实现函数，在此函数中填入答题代码;
    bool Calculate(const string &expression, int &result) {
        int index = 0;
        stack<int> number;
        stack<char> op;
        if (!isdigit(expression[0])) {
            number.push(0);
        }
        while (index < expression.size()) {
            //如果是数字则读取数字
            if (isdigit(expression[index])) {
                int num = getNumber(index, expression);
                //将高优先级的运算符进行计算
                if (!op.empty() and (op.top() == '/' or op.top() == '*')) {
                    int num1 = number.top();
                    number.pop();
                    if (op.top() == '/' and num == 0) {
                        return false;
                    }
                    num = op.top() == '/' ? num1 / num : num1 * num;
                    op.pop();
                }
                //高优先级运算完成后，入栈
                number.push(num);
            } else {
                //不是数字则将运算符入栈
                op.push(expression[index]);
                index++;
            }
        }
        //次数只剩下+ - 运算
        result = number.top();
        number.pop();
        while (!op.empty()) {
            int num1 = number.top();
            number.pop();
            result = op.top() == '+' ? num1 + result : num1 - result;
            op.pop();
        }
        // if (!number.empty()) return false;
        return true;
    }
};

inline string ReadLine() {
    string line;
    getline(cin, line);
    return line;
}

int main() {
    string expr = ReadLine();
    Solution solu;
    int result = 0;
    bool isOk = solu.Calculate(expr, result);
    if (isOk) {
        cout << result;
    } else {
        cout << "error";
    }
    return 0;
}
